/**
 * 
 */
package sv.gob.mh.dgii.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @author melvin.henriquez
 * 
 */
@Entity
@Table(name = "DV_NIT_EMISION", schema = "DEVOLUCIONES")
public class DvNitEmision implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3968285029023895426L;
	private DvNitEmisionId id;
	private Date fhingreso;
	private String cusuario;
	private RcRuc rcRuc;
	private DvEmision dvEmision;

	public DvNitEmision() {
		// TODO Auto-generated constructor stub
	}

	public DvNitEmision(DvNitEmisionId id) {
		this.id = id;
	}

	/**
	 * @return the id
	 */
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "nit", column = @Column(length = 14, name = "NIT", nullable = false)),
			@AttributeOverride(name = "nemision", column = @Column(name = "N_EMISION", nullable = false)) })
	public DvNitEmisionId getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(DvNitEmisionId id) {
		this.id = id;
	}

	/**
	 * @return the fhingreso
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(insertable = false, length = 7, name = "FH_INGRESO")
	public Date getFhingreso() {
		return fhingreso;
	}

	/**
	 * @param fhingreso
	 *            the fhingreso to set
	 */
	public void setFhingreso(Date fhingreso) {
		this.fhingreso = fhingreso;
	}

	/**
	 * @return the cusuario
	 */
	@Column(length = 30, name = "C_USUARIO", nullable = false)
	public String getCusuario() {
		return cusuario;
	}

	/**
	 * @param cusuario
	 *            the cusuario to set
	 */
	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	/**
	 * @return the rcRuc
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "NIT", referencedColumnName = "NIT", nullable = false, insertable = false, updatable = false)
	public RcRuc getRcRuc() {
		return rcRuc;
	}

	/**
	 * @param rcRuc
	 *            the rcRuc to set
	 */
	public void setRcRuc(RcRuc rcRuc) {
		this.rcRuc = rcRuc;
	}

	/**
	 * @return the dvEmision
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "N_EMISION", referencedColumnName = "N_EMISION", nullable = false, insertable = false, updatable = false)
	public DvEmision getDvEmision() {
		return dvEmision;
	}

	/**
	 * @param dvEmision
	 *            the dvEmision to set
	 */
	public void setDvEmision(DvEmision dvEmision) {
		this.dvEmision = dvEmision;
	}

}
